]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
ShellApp: Use integer for size, not float
authorColin Walters <walters@verbum.org>
Thu, 11 Aug 2011 09:44:19 +0000 (05:44 -0400)
committerColin Walters <walters@verbum.org>
Thu, 11 Aug 2011 09:44:19 +0000 (05:44 -0400)
We were basically casting it everywhere except for ClutterActor -
let's be consistent with StTextureCache and use integers.

https://bugzilla.gnome.org/show_bug.cgi?id=648149

src/shell-app.c
src/shell-app.h

index 1654401fa7f1fe845bfe0a31bc1c57e455eb66a4..b4b65d7e09593c9eb254a6f8a783e74eb45571ba 100644 (file)
@@ -133,7 +133,7 @@ window_backed_app_get_window (ShellApp     *app)
  */
 ClutterActor *
 shell_app_create_icon_texture (ShellApp   *app,
-                               float size)
+                               int         size)
 {
   GIcon *icon;
   ClutterActor *ret;
@@ -150,12 +150,12 @@ shell_app_create_icon_texture (ShellApp   *app,
 
   icon = g_app_info_get_icon (G_APP_INFO (gmenu_tree_entry_get_app_info (app->entry)));
   if (icon != NULL)
-    ret = st_texture_cache_load_gicon (st_texture_cache_get_default (), NULL, icon, (int)size);
+    ret = st_texture_cache_load_gicon (st_texture_cache_get_default (), NULL, icon, size);
 
   if (ret == NULL)
     {
       icon = g_themed_icon_new ("application-x-executable");
-      ret = st_texture_cache_load_gicon (st_texture_cache_get_default (), NULL, icon, (int)size);
+      ret = st_texture_cache_load_gicon (st_texture_cache_get_default (), NULL, icon, size);
       g_object_unref (icon);
     }
 
@@ -199,7 +199,7 @@ shell_app_create_faded_icon_cpu (StTextureCache *cache,
   if (icon != NULL)
     {
       info = gtk_icon_theme_lookup_by_gicon (gtk_icon_theme_get_default (),
-                                             icon, (int) (size + 0.5),
+                                             icon, size,
                                              GTK_ICON_LOOKUP_FORCE_SIZE);
     }
 
@@ -207,7 +207,7 @@ shell_app_create_faded_icon_cpu (StTextureCache *cache,
     {
       icon = g_themed_icon_new ("application-x-executable");
       info = gtk_icon_theme_lookup_by_gicon (gtk_icon_theme_get_default (),
-                                             icon, (int) (size + 0.5),
+                                             icon, size,
                                              GTK_ICON_LOOKUP_FORCE_SIZE);
       g_object_unref (icon);
     }
@@ -273,7 +273,7 @@ shell_app_create_faded_icon_cpu (StTextureCache *cache,
  * Return value: (transfer none): A floating #ClutterActor, or %NULL if no icon
  */
 ClutterActor *
-shell_app_get_faded_icon (ShellApp *app, float size)
+shell_app_get_faded_icon (ShellApp *app, int size)
 {
   CoglHandle texture;
   ClutterActor *result;
@@ -293,9 +293,9 @@ shell_app_get_faded_icon (ShellApp *app, float size)
     }
     
 
-  cache_key = g_strdup_printf ("faded-icon:%s,size=%f", shell_app_get_id (app), size);
+  cache_key = g_strdup_printf ("faded-icon:%s,size=%d", shell_app_get_id (app), size);
   data.app = app;
-  data.size = (int) (0.5 + size);
+  data.size = size;
   texture = st_texture_cache_load (st_texture_cache_get_default (),
                                    cache_key,
                                    ST_TEXTURE_CACHE_POLICY_FOREVER,
@@ -312,7 +312,7 @@ shell_app_get_faded_icon (ShellApp *app, float size)
   else
     {
       result = clutter_texture_new ();
-      g_object_set (result, "opacity", 0, "width", size, "height", size, NULL);
+      g_object_set (result, "opacity", 0, "width", (float) size, "height", (float) size, NULL);
 
     }
   return result;
index 8f4f0e6c247f35247c817e7e36cb15d55ec639c8..62022fef2424b542b773ba0602928d3115c16ade 100644 (file)
@@ -39,8 +39,8 @@ const char *shell_app_get_id (ShellApp *app);
 GMenuTreeEntry *shell_app_get_tree_entry (ShellApp *app);
 GDesktopAppInfo *shell_app_get_app_info (ShellApp *app);
 
-ClutterActor *shell_app_create_icon_texture (ShellApp *app, float size);
-ClutterActor *shell_app_get_faded_icon (ShellApp *app, float size);
+ClutterActor *shell_app_create_icon_texture (ShellApp *app, int size);
+ClutterActor *shell_app_get_faded_icon (ShellApp *app, int size);
 const char *shell_app_get_name (ShellApp *app);
 const char *shell_app_get_description (ShellApp *app);
 gboolean shell_app_is_window_backed (ShellApp *app);